Session variables and IE7
am 05.09.2007 19:46:33 von bulldog8I have a web page set up for doctors to request vacation. All was
tabindex=\"4\"" .($Priority == '2'?' checked ':''). ">" . _("Priority
tabindex=\"5\"" .($Priority == '3'?' checked ':''). ">" . _("Priority
working well until they upgrade their home PCs to IE7, at which time
the variables lose their values when they click submit. We've allowed
cookies from this site and allowed JS to run in an attempt to fix the
issue, but no luck.
I use a javascript calendar and additional javascript to make sure the
end date > start date.
The user can still use the calendar tool to select dates and the js
still correctly ensures the end date and num of days requested fields
are populated correctly, so I am looking at my PHP code first.
Is there some error in my handling of session variables?
PHP code:
/**
* request.php
*
* Sends an email containing a vacation request and posts to database.
*
*/
session_start();
//Let's see if they want to go to another page first
if (strlen($btn) > 0) {
//save this pages info in case they come back
$rqst['Priority'] = $Priority;
$rqst['txtStartDate'] = $txtStartDate;
$rqst['txtEndDate'] = $txtEndDate;
$rqst['body'] = $body;
$rqst['txtNumReq'] = $txtNumReq;
$_SESSION['rqst'] = $rqst;
if (($btn == "recruit") || ($btn == "info")) {
}
else {
require_once('../source/validate.php');
require_once('../fn/vac_data.php');
require_once('../cfg/config.php');
require_once('../fn/page_header.php');
//If they were here before lets get their input
if (isset($_SESSION['rqst'])) {
$rqst = $_SESSION['rqst'];
$Priority = $rqst['Priority'];
$txtStartDate = $rqst['txtStartDate'];
$txtEndDate = $rqst['txtEndDate'];
$body = $rqst['body'];
$txtNumReq = $rqst['txtNumReq'];
}
$vdays = 0;
if (!isset($_SESSION['vdays'])) {
$_SESSION['vdays'] = 0;
}
else {
unset($_SESSION['vdays']);
$_SESSION['vdays'] = 0;
}
$mailbox = 'INBOX';
if (isset($btnReset)) {
//Check to make sure this person is authorized
$imapConnection = fnimap_login($username, $key,
$imapServerAddress,$imapPort, 0);
$Priority = '1';
$txtStartDate = '';
$txtEndDate = '';
$body = '';
$txtNumReq = 0;
showInputForm();
fnimap_logout($imapConnection);
}
/* Send the Request */
elseif (isset($send)) {
if (checkInput(false)) {
$chkmsg = '';
$_SESSION['chkmsg']="";
$chkmsg = fnCheckDates(); //$vdays set in the fnCheckDates
function
if ($vdays < 0) {
showInputForm();
exit();
}
$urlMailbox = urlencode (trim($mailbox));
set_my_charset();
/* Format the & send message to include dates and priority
selections */
<
$Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
$subject, $comment, $reply_id, $MDN,
$mailprio);
}
if (! $Result) {
showInputForm();
exit();
}
//Call MySQL function to save data
$Result = saveVac($txtStartDate, $txtEndDate, $Priority,
$vdays, $body);
if (! $Result) {
showInputForm();
exit();
}
Header("Location: request.php?mail_sent=yes");
} else {
checkInput(true);
showInputForm();
}
} else {
/*
* This handles the default case as well as the error case
* (they had the same code) --> if (isset($smtpErrors))
*/
$imapConnection = fnimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
$newmail = true;
showInputForm();
fnimap_logout($imapConnection);
}
}
exit();
function showInputForm () {
global $send_to, $send_to_cc, $body, $subject, $org_logo,
$btn, $txtStartDate, $txtEndDate, $Priority, $txtNumReq, $chkmsg,
$reply_id, $mailbox, $User_Name, $vdays, $prefs_are_cached,
$username, $data_dir, $default_sendto, $oncall,
$oncall_cnt,
$mailprio, $default_use_mdn, $mdn_user_support,
$compose_new_win,
$mail_sent, $this_yr, $next_yr, $cur_p1, $cur_p2, $cur_p3,
$next_p1, $next_p2, $next_p3;
$btn = '';
$User_Name = getPref($data_dir, $username, 'User_Name');
$subject = 'Vacation request for ' . $User_Name;
$send_to = $default_sendto;
$send_to_cc = getPref($data_dir, $username,'CC_Reply_to', 0);
if ($Priority == '') {
$Priority = '1';
}
if ($txtStartDate == '') {
$txtStartDate = date("m/d/Y");
}
if ($txtEndDate=='') {
$txtEndDate = date("m/d/Y",strtotime("1
days",strtotime($txtStartDate)));
}
if ($txtNumReq=='') {
$txtNumReq = 0;
}
$MyName = "request";
$Cal = 1;
$Oncall = 0;
$RTE = 0;
$Title = "Vacation Request";
displaytxan_header($MyName, $User_Name, $Cal, $Title, $Oncall,
$RTE);
if ($mail_sent == 'yes') {
echo '
CENTER>';
}
if ($vdays < 0) {
echo '
echo '
}
echo "
width=\"100%\" height=\"16\"
bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\">
\"43\">Vacation Request
";
";
1; margin-bottom: 1\">
Start Date
id=txtStartDate size=\"20\" tabindex=\"1\" value=\"" .
$txtStartDate ."\">
\"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
yyyy'); return false;\"
TITLE=\"cal5.showCalendar('anchor5'); return false;\"
NAME=\"anchor5\" ID=\"anchor5\">
width=\"16\" height=\"16\" border=\"0\" alt=\"Pick Start date\">
A>
1; margin-bottom: 1\">
End Date
id=txtEndDate size=\"20\" tabindex=\"2\" value=\"" . $txtEndDate ."\">
\"cal6.select(document.forms['request'].txtEndDate,'anchor5' ,'MM/dd/
yyyy');; return false;\"
TITLE=\"cal6.showCalendar('anchor6'); return false;\"
NAME=\"anchor6\" ID=\"anchor6\">
width=\"16\" height=\"16\" border=\"0\" alt=\"Pick End date\">
A>
Days Requested:
\"txtNumReq\" id=\"txtNumReq\" size=\"20\" value=\"" .
$txtNumReq ."\">
if (!isset($this_yr)) {
$this_yr = date("Y");
session_register('this_yr');
$next_yr = $this_yr + 1;
session_register('next_yr');
}
$prefs_are_cached = FALSE;
cachePrefValues($data_dir, $username);
$cur_p1 = getPref($data_dir, $username,'Cur_P1', 0);
$cur_p2 = getPref($data_dir, $username,'Cur_P2', 0);
$cur_p3 = getPref($data_dir, $username,'Cur_P3', 0);
$next_p1 = getPref($data_dir, $username,'Next_P1', 0);
$next_p2 = getPref($data_dir, $username,'Next_P2', 0);
$next_p3 = getPref($data_dir, $username,'Next_P3', 0);
echo "
bordercolor=\"#000000\" rowspan=\"2\">
bottom: 1\">Vacation Days Remaining :
bottom: 1\">
bottom: 1\">" . $this_yr . "
bottom: 1\">Priority 1 " . $cur_p1 . "
bottom: 1\">Priority 2 " . $cur_p2 . "
bottom: 1\">Priority 3 " . $cur_p3 . "
bottom: 1\">
bottom: 1\">" . $next_yr . "
bottom: 1\">Priority 1 " . $next_p1 . "
bottom: 1\">Priority 2 " . $next_p2 . "
bottom: 1\">Priority 3 " . $next_p3 . "
echo "
2\">
tabindex=\"3\"" .($Priority == '1'?' checked ':'') . ">" .
_("Priority 1") . "
2") . "
3") . "
";
echo "
top: 1; margin-bottom: 1\">
bottom: 1\">
1; margin-bottom: 1\">
1; margin-bottom: 1\">Comments
1; margin-bottom: 1\">
WRAP=VIRTUAL> " . htmlspecialchars($body) . "
bordercolor=\"#FFFFFF\">
"\">
Form") . "\">
htmlspecialchars($mailbox) . "\">
htmlspecialchars($send_to) . "\">
htmlspecialchars($send_to_cc) . "\">
htmlspecialchars($subject) . "\">
htmlspecialchars($btn) . "\">
\"position:absolute;visibility:hidden;background-color:white ;layer-
background-color:white;\">";
echo "";
echo "";
echo '